2252e39337544165d876e94b431bbea8a6556181
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.11.4)
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 #
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")
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_RANLIB
28 AC_CONFIG_SUBDIRS(libltdl)
30 #
31 # Checks for header files.
32 #
33 AC_HEADER_STDC
34 AC_HEADER_SYS_WAIT
35 AC_HEADER_DIRENT
36 AC_CHECK_HEADERS(stdint.h)
37 AC_CHECK_HEADERS(stdio.h)
38 AC_CHECK_HEADERS(errno.h)
39 AC_CHECK_HEADERS(math.h)
40 AC_CHECK_HEADERS(syslog.h)
41 AC_CHECK_HEADERS(fcntl.h)
42 AC_CHECK_HEADERS(signal.h)
43 AC_CHECK_HEADERS(assert.h)
44 AC_CHECK_HEADERS(sys/types.h)
45 AC_CHECK_HEADERS(sys/socket.h)
46 AC_CHECK_HEADERS(sys/select.h)
47 AC_CHECK_HEADERS(sys/poll.h)
48 AC_CHECK_HEADERS(netdb.h)
49 AC_CHECK_HEADERS(arpa/inet.h)
50 AC_CHECK_HEADERS(sys/resource.h)
51 AC_CHECK_HEADERS(sys/param.h)
53 # For ping library
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
55 [#if HAVE_STDINT_H
56 # include <stdint.h>
57 #endif
58 #if HAVE_SYS_TYPES_H
59 # include <sys/types.h>
60 #endif
61 ])
62 AC_CHECK_HEADERS(netinet/in.h, [], [],
63 [#if HAVE_STDINT_H
64 # include <stdint.h>
65 #endif
66 #if HAVE_SYS_TYPES_H
67 # include <sys/types.h>
68 #endif
69 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
71 #endif
72 ])
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
74 [#if HAVE_STDINT_H
75 # include <stdint.h>
76 #endif
77 #if HAVE_SYS_TYPES_H
78 # include <sys/types.h>
79 #endif
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
82 #endif
83 #if HAVE_NETINET_IN_H
84 # include <netinet/in.h>
85 #endif
86 ])
87 AC_CHECK_HEADERS(netinet/ip_icmp.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 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
96 #endif
97 #if HAVE_NETINET_IN_H
98 # include <netinet/in.h>
99 #endif
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
102 #endif
103 ])
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
105 [#if HAVE_STDINT_H
106 # include <stdint.h>
107 #endif
108 #if HAVE_SYS_TYPES_H
109 # include <sys/types.h>
110 #endif
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
113 #endif
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
116 #endif
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
119 #endif
120 ])
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
122 [#if HAVE_STDINT_H
123 # include <stdint.h>
124 #endif
125 #if HAVE_SYS_TYPES_H
126 # include <sys/types.h>
127 #endif
128 #if HAVE_NETINET_IN_SYSTM_H
129 # include <netinet/in_systm.h>
130 #endif
131 #if HAVE_NETINET_IN_H
132 # include <netinet/in.h>
133 #endif
134 ])
135 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
136 [#if HAVE_STDINT_H
137 # include <stdint.h>
138 #endif
139 #if HAVE_SYS_TYPES_H
140 # include <sys/types.h>
141 #endif
142 #if HAVE_NETINET_IN_SYSTM_H
143 # include <netinet/in_systm.h>
144 #endif
145 #if HAVE_NETINET_IN_H
146 # include <netinet/in.h>
147 #endif
148 #if HAVE_NETINET_IP6_H
149 # include <netinet/ip6.h>
150 #endif
151 ])
152 AC_CHECK_HEADERS(netinet/udp.h, [], [],
153 [#if HAVE_STDINT_H
154 # include <stdint.h>
155 #endif
156 #if HAVE_SYS_TYPES_H
157 # include <sys/types.h>
158 #endif
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
161 #endif
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
164 #endif
165 #if HAVE_NETINET_IP_H
166 # include <netinet/ip.h>
167 #endif
168 ])
170 # For cpu modules
171 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
172 AC_CHECK_HEADERS(mach/mach_init.h)
173 AC_CHECK_HEADERS(mach/host_priv.h)
174 AC_CHECK_HEADERS(mach/mach_error.h)
175 AC_CHECK_HEADERS(mach/mach_host.h)
176 AC_CHECK_HEADERS(mach/mach_port.h)
177 AC_CHECK_HEADERS(mach/mach_types.h)
178 AC_CHECK_HEADERS(mach/message.h)
179 AC_CHECK_HEADERS(mach/processor_set.h)
180 AC_CHECK_HEADERS(mach/processor.h)
181 AC_CHECK_HEADERS(mach/processor_info.h)
182 AC_CHECK_HEADERS(mach/task.h)
183 AC_CHECK_HEADERS(mach/thread_act.h)
184 AC_CHECK_HEADERS(mach/vm_region.h)
185 AC_CHECK_HEADERS(mach/vm_map.h)
186 AC_CHECK_HEADERS(mach/vm_prot.h)
187 AC_CHECK_HEADERS(mach/vm_statistics.h)
188 AC_CHECK_HEADERS(mach/kern_return.h)
190 # For hddtemp module
191 AC_CHECK_HEADERS(linux/major.h)
193 # For the apple_sensors module
194 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
195 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
196 AC_CHECK_HEADERS(IOKit/IOTypes.h)
198 # For the battery plugin
199 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
200 [
201 #if HAVE_IOKIT_IOKITLIB_H
202 # include <IOKit/IOKitLib.h>
203 #endif
204 #if HAVE_IOKIT_IOTYPES_H
205 # include <IOKit/IOTypes.h>
206 #endif
207 ])
208 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
210 # For the `disk' plugin
211 AC_CHECK_HEADERS(IOKit/IOBSD.h)
212 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
214 # For load module
215 AC_CHECK_HEADERS(sys/loadavg.h)
217 # For the processes plugin
218 AC_CHECK_HEADERS(linux/config.h)
220 # For the swap module
221 AC_CHECK_HEADERS(sys/swap.h)
223 # For users module
224 AC_CHECK_HEADERS(utmp.h)
225 AC_CHECK_HEADERS(utmpx.h)
227 # For traffic plugin
228 AC_CHECK_HEADERS(ifaddrs.h)
229 AC_CHECK_HEADERS(net/if.h, [], [],
230 [
231 #if HAVE_SYS_TYPES_H
232 # include <sys/types.h>
233 #endif
234 #if HAVE_SYS_SOCKET_H
235 # include <sys/socket.h>
236 #endif
237 ])
238 AC_CHECK_HEADERS(linux/if.h, [], [],
239 [
240 #if HAVE_SYS_TYPES_H
241 # include <sys/types.h>
242 #endif
243 #if HAVE_SYS_SOCKET_H
244 # include <sys/socket.h>
245 #endif
246 ])
247 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
248 [
249 #if HAVE_SYS_TYPES_H
250 # include <sys/types.h>
251 #endif
252 #if HAVE_SYS_SOCKET_H
253 # include <sys/socket.h>
254 #endif
255 #if HAVE_LINUX_IF_H
256 # include <linux/if.h>
257 #endif
258 ])
260 # For apache plugin
261 AC_CHECK_HEADERS(curl/curl.h)
263 # For quota module
264 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
265 AC_CHECK_HEADERS(ctype.h)
266 AC_CHECK_HEADERS(limits.h)
267 AC_CHECK_HEADERS(sys/quota.h)
268 AC_CHECK_HEADERS(xfs/xqm.h)
270 # For mount interface
271 AC_CHECK_HEADERS(fs_info.h)
272 AC_CHECK_HEADERS(fshelp.h)
273 AC_CHECK_HEADERS(paths.h)
274 AC_CHECK_HEADERS(mntent.h)
275 AC_CHECK_HEADERS(mnttab.h)
276 AC_CHECK_HEADERS(sys/fstyp.h)
277 AC_CHECK_HEADERS(sys/fs_types.h)
278 AC_CHECK_HEADERS(sys/mntent.h)
279 AC_CHECK_HEADERS(sys/mnttab.h)
280 AC_CHECK_HEADERS(sys/mount.h)
281 AC_CHECK_HEADERS(sys/statfs.h)
282 AC_CHECK_HEADERS(sys/statvfs.h)
283 AC_CHECK_HEADERS(sys/vfs.h)
284 AC_CHECK_HEADERS(sys/vfstab.h)
286 # For the swap plugin, FreeBSD
287 AC_CHECK_HEADERS(kvm.h)
289 # For the email plugin
290 AC_CHECK_HEADERS(linux/un.h, [], [],
291 [
292 #if HAVE_SYS_SOCKET_H
293 # include <sys/socket.h>
294 #endif
295 ])
296 AC_CHECK_HEADERS(sys/un.h)
297 AC_CHECK_HEADERS(grp.h)
299 # For debugging interface (variable number of arguments)
300 AC_CHECK_HEADERS(stdarg.h)
302 # Regular expressions for the ignorelist.
303 AC_CHECK_HEADERS(regex.h)
305 # For the dns plugin
306 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
308 AC_CHECK_HEADERS(net/if_arp.h, [], [],
309 [#if HAVE_SYS_SOCKET_H
310 # include <sys/socket.h>
311 #endif
312 ])
313 AC_CHECK_HEADERS(net/if_ppp.h)
314 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
315 [#if HAVE_STDINT_H
316 # include <stdint.h>
317 #endif
318 #if HAVE_SYS_TYPES_H
319 # include <sys/types.h>
320 #endif
321 #if HAVE_SYS_SOCKET_H
322 # include <sys/socket.h>
323 #endif
324 #if HAVE_NET_IF_H
325 # include <net/if.h>
326 #endif
327 #if HAVE_NETINET_IN_H
328 # include <netinet/in.h>
329 #endif
330 ])
332 #
333 # Checking for libraries
334 #
335 AC_CHECK_LIB(m, ext)
337 #
338 # Checks for typedefs, structures, and compiler characteristics.
339 #
340 AC_C_CONST
341 AC_TYPE_PID_T
342 AC_TYPE_SIZE_T
343 AC_TYPE_UID_T
344 AC_HEADER_TIME
346 #
347 # Checks for library functions.
348 #
349 AC_PROG_GCC_TRADITIONAL
350 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
351 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
352 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
353 AC_CHECK_FUNCS(strncasecmp strcasecmp)
354 AC_CHECK_FUNCS(openlog syslog closelog)
356 socket_needs_socket="no"
357 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
358 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
360 nanosleep_needs_rt="no"
361 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
362 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
364 # Regular expressions for the ignorelist.
365 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
367 # For cpu module
368 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
370 # For df module
371 AC_CHECK_FUNCS(statfs statvfs)
373 # For load module
374 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
376 # For the `processes' plugin
377 AC_CHECK_FUNCS(thread_info)
379 # For users module
380 AC_CHECK_FUNCS(getutent getutxent)
382 # For quota module
383 AC_CHECK_FUNCS(quotactl)
384 AC_CHECK_FUNCS(getgrgid getpwuid)
386 # For traffic module
387 AC_CHECK_FUNCS(getifaddrs)
389 # For mount interface
390 #AC_CHECK_FUNCS(getfsent getvfsent)
392 have_getfsstat="no"
393 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
394 have_getvfsstat="no"
395 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
396 have_listmntent="no"
397 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
399 have_getmntent="no"
400 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
401 if test "x$have_getmntent" = "xno"; then
402 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
403 fi
404 if test "x$have_getmntent" = "xno"; then
405 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
406 fi
407 if test "x$have_getmntent" = "xno"; then
408 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
409 fi
411 if test "x$have_getmntent" = "xc"; then
412 AC_CACHE_CHECK([whether getmntent takes one argument],
413 [have_one_getmntent],
414 AC_COMPILE_IFELSE(
415 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
416 #include <mntent.h>
417 #include "$srcdir/src/utils_mount.h"]],
418 [[
419 FILE *fh;
420 struct mntent *me;
421 fh = setmntent ("/etc/mtab", "r");
422 me = getmntent (fh);
423 ]]
424 ),
425 [have_one_getmntent="yes"],
426 [have_one_getmntent="no"]
427 )
428 )
429 AC_CACHE_CHECK([whether getmntent takes two arguments],
430 [have_two_getmntent],
431 AC_COMPILE_IFELSE(
432 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
433 #include <sys/mnttab.h>
434 #include "$srcdir/src/utils_mount.h"]],
435 [[
436 FILE *fh;
437 struct mnttab mt;
438 int status;
439 fh = fopen ("/etc/mnttab", "r");
440 status = getmntent (fh, &mt);
441 ]]
442 ),
443 [have_two_getmntent="yes"],
444 [have_two_getmntent="no"]
445 )
446 )
447 fi
449 # Check for different versions of `getmntent' here..
451 if test "x$have_getmntent" = "xc"; then
452 if test "x$have_one_getmntent" = "xyes"; then
453 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
454 [Define if the function getmntent exists and takes one argument.])
455 fi
456 if test "x$have_two_getmntent" = "xyes"; then
457 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
458 [Define if the function getmntent exists and takes two arguments.])
459 fi
460 fi
461 if test "x$have_getmntent" = "xsun"; then
462 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
463 [Define if the function getmntent exists. It's the version from libsun.])
464 fi
465 if test "x$have_getmntent" = "xseq"; then
466 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
467 [Define if the function getmntent exists. It's the version from libseq.])
468 fi
469 if test "x$have_getmntent" = "xgen"; then
470 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
471 [Define if the function getmntent exists. It's the version from libgen.])
472 fi
474 # Check for structures
475 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
476 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
477 [],
478 [
479 #include <sys/types.h>
480 #include <sys/socket.h>
481 #include <net/if.h>
482 ])
483 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
484 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
485 [],
486 [
487 #include <sys/types.h>
488 #include <sys/socket.h>
489 #include <linux/if.h>
490 #include <linux/netdevice.h>
491 ])
493 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
494 [#if HAVE_STDINT_H
495 # include <stdint.h>
496 #endif
497 #if HAVE_SYS_TYPES_H
498 # include <sys/types.h>
499 #endif
500 #if HAVE_NETINET_IN_SYSTM_H
501 # include <netinet/in_systm.h>
502 #endif
503 #if HAVE_NETINET_IN_H
504 # include <netinet/in.h>
505 #endif
506 #if HAVE_NETINET_IP_H
507 # include <netinet/ip.h>
508 #endif
509 #if HAVE_NETINET_UDP_H
510 # include <netinet/udp.h>
511 #endif
512 ])
513 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
514 [#if HAVE_STDINT_H
515 # include <stdint.h>
516 #endif
517 #if HAVE_SYS_TYPES_H
518 # include <sys/types.h>
519 #endif
520 #if HAVE_NETINET_IN_SYSTM_H
521 # include <netinet/in_systm.h>
522 #endif
523 #if HAVE_NETINET_IN_H
524 # include <netinet/in.h>
525 #endif
526 #if HAVE_NETINET_IP_H
527 # include <netinet/ip.h>
528 #endif
529 #if HAVE_NETINET_UDP_H
530 # include <netinet/udp.h>
531 #endif
532 ])
534 AC_MSG_CHECKING([for kernel type ($host_os)])
535 case $host_os in
536 *linux*)
537 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
538 ac_system="Linux"
539 ;;
540 *solaris*)
541 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
542 ac_system="Solaris"
543 ;;
544 *)
545 ac_system="unknown"
546 esac
547 AC_MSG_RESULT([$ac_system])
549 with_libresolv="yes"
550 AC_CHECK_LIB(resolv, res_search,
551 [
552 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
553 ],
554 [with_libresolv="no"])
555 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
558 m4_divert_once([HELP_WITH], [
559 collectd additional packages:])
561 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
562 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
563 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
564 then
565 LDFLAGS="$LDFLAGS -L$withval/lib"
566 CPPFLAGS="$CPPFLAGS -I$withval/include"
567 with_rrdtool="yes"
568 fi
569 ], [with_rrdtool="yes"])
570 if test "x$with_rrdtool" = "xyes"
571 then
572 AC_CHECK_LIB(rrd, rrd_update,
573 [
574 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
575 ],
576 [with_rrdtool="no (librrd not found)"], [-lm])
577 fi
578 if test "x$with_rrdtool" = "xyes"
579 then
580 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
581 fi
582 if test "x$with_rrdtool" = "xyes"
583 then
584 collect_rrdtool=1
585 else
586 collect_rrdtool=0
587 fi
588 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
589 [Wether or not to use rrdtool library])
590 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
592 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
593 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
594 then
595 LDFLAGS="$LDFLAGS -L$withval/lib"
596 CPPFLAGS="$CPPFLAGS -I$withval/include"
597 with_libpthread="yes"
598 else
599 if test "x$withval" = "xno"
600 then
601 with_libpthread="no (disabled)"
602 fi
603 fi
604 ], [with_libpthread="yes"])
605 if test "x$with_libpthread" = "xyes"
606 then
607 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
608 fi
609 if test "x$with_libpthread" = "xyes"
610 then
611 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
612 fi
613 if test "x$with_libpthread" = "xyes"
614 then
615 collect_pthread=1
616 else
617 collect_pthread=0
618 fi
619 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
620 [Wether or not to use pthread (POSIX threads) library])
621 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
623 if test "$ac_system" = "Solaris"
624 then
625 with_kstat="yes"
626 with_devinfo="yes"
627 else
628 with_kstat="no (Solaris only)"
629 with_devinfo="no (Solaris only)"
630 fi
632 if test "x$with_kstat" = "xyes"
633 then
634 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
635 fi
636 if test "x$with_kstat" = "xyes"
637 then
638 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
639 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
640 fi
641 if test "x$with_kstat" = "xyes"
642 then
643 AC_DEFINE(HAVE_LIBKSTAT, 1,
644 [Define to 1 if you have the 'kstat' library (-lkstat)])
645 fi
646 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
647 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
649 ### BEGIN of check for libcurl ###
650 with_curl_config="curl-config"
651 with_curl_prefix=0
652 with_curl_libs=""
653 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
654 [
655 if test "x$withval" != "xno" -a "x$withval" != "xyes"
656 then
657 if test -x "$withval/bin/curl-config"
658 then
659 with_curl_config="$withval/bin/curl-config"
660 with_curl_prefix=1
661 fi
662 fi
663 if test "x$withval" = "xno"
664 then
665 with_libcurl="no"
666 else
667 with_libcurl="yes"
668 fi
669 ],
670 [
671 with_libcurl="yes"
672 ])
673 if test "x$with_libcurl" = "xyes"
674 then
675 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
676 curl_config_status=$?
678 if test $curl_config_status -ne 0
679 then
680 with_libcurl="no"
681 else
682 AC_CHECK_LIB(curl, curl_easy_init,
683 [
684 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
685 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
686 ],
687 [
688 with_libcurl="no"
689 ],
690 [$with_curl_libs])
691 fi
692 fi
693 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
694 then
695 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
696 curl_config_status=$?
698 if test $curl_config_status -ne 0
699 then
700 with_libcurl="no"
701 else
702 if test -d "$with_curl_prefix/include"
703 then
704 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
705 fi
706 fi
707 fi
709 with_libcurl_numeric=0
710 if test "x$with_libcurl" = "xyes"
711 then
712 with_libcurl_numeric=1
713 fi
714 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
715 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
716 ### END of check for libcurl ###
718 with_libiokit="no"
719 collectd_libiokit=0
720 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
721 [
722 with_libiokit="yes"
723 collectd_libiokit=1
724 ],
725 [
726 with_libiokit="no"
727 collectd_libiokit=0
728 ])
729 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
730 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
732 with_libstatgrab="yes"
733 with_libdevstat="no"
734 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
735 [
736 if test "x$withval" != "xno" -a "x$withval" != "xyes"
737 then
738 LDFLAGS="$LDFLAGS -L$withval/lib"
739 CPPFLAGS="$CPPFLAGS -I$withval/include"
740 with_libstatgrab="yes"
741 fi
742 ],
743 [
744 if test "x$ac_system" == "xunknown"
745 then
746 with_libstatgrab="yes"
747 else
748 with_libstatgrab="no"
749 fi
750 ])
751 if test "x$with_libstatgrab" = "xyes"
752 then
753 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
754 fi
755 if test "x$with_libstatgrab" = "xyes"
756 then
757 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
758 fi
759 if test "x$with_libstatgrab" = "xyes"
760 then
761 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
762 fi
763 if test "x$with_libstatgrab" = "xyes"
764 then
765 collect_libstatgrab=1
766 else
767 collect_libstatgrab=0
768 fi
769 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
770 [Wether or not to use statgrab library])
771 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
772 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
774 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
775 if test "x$with_libkvm" = "xyes"
776 then
777 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
778 fi
779 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
781 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
782 [
783 if test "x$withval" != "xno" && test "x$withval" != "xyes"
784 then
785 LDFLAGS="$LDFLAGS -L$withval/lib"
786 CPPFLAGS="$CPPFLAGS -I$withval/include"
787 with_lm_sensors="yes"
788 fi
789 ],
790 [
791 if test "x$ac_system" = "xLinux"
792 then
793 with_lm_sensors="yes"
794 else
795 with_lm_sensors="no"
796 fi
797 ])
798 if test "x$with_lm_sensors" = "xyes"
799 then
800 AC_CHECK_LIB(sensors, sensors_init,
801 [
802 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
803 ],
804 [with_lm_sensors="no (libsensors not found)"])
805 fi
806 if test "x$with_lm_sensors" = "xyes"
807 then
808 AC_CHECK_HEADERS(sensors/sensors.h,
809 [
810 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
811 ],
812 [with_lm_sensors="no (sensors/sensors.h not found)"])
813 fi
814 if test "x$with_lm_sensors" = "xyes"
815 then
816 collect_lm_sensors=1
817 else
818 collect_lm_sensors=0
819 fi
820 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
821 [Wether or not to use sensors library])
822 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
824 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
825 [
826 if test "x$withval" != "xno" && test "x$withval" != "xyes"
827 then
828 LDFLAGS="$LDFLAGS -L$withval/lib"
829 CPPFLAGS="$CPPFLAGS -I$withval/include"
830 with_libmysql="yes"
831 fi
832 ],
833 [
834 with_libmysql="yes"
835 ])
836 if test "x$with_libmysql" = "xyes"
837 then
838 AC_CHECK_LIB(mysqlclient, mysql_init,
839 [
840 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
841 ], [with_libmysql="no (libmysql not found)"])
842 fi
843 if test "x$with_libmysql" = "xyes"
844 then
845 AC_CHECK_HEADERS(mysql/mysql.h,
846 [
847 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
848 ], [with_libmysql="no (mysql/mysql.h not found)"])
849 fi
850 if test "x$with_libmysql" = "xyes"
851 then
852 collect_libmysql=1
853 else
854 collect_libmysql=0
855 fi
856 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
857 [Wether or not to use mysql library])
858 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
860 #with_liboping="yes"
861 with_own_liboping="no"
862 liboping_LDFLAGS="$LDFLAGS"
863 liboping_CPPFLAGS="$CPPFLAGS"
864 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
865 [
866 if test "x$withval" != "xno" && test "x$withval" != "xyes"
867 then
868 if test -d "$withval/lib"
869 then
870 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
871 fi
872 if test -d "$withval/include"
873 then
874 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
875 fi
876 fi
877 if test "x$withval" = "xno"
878 then
879 with_liboping="no"
880 with_own_liboping="no"
881 fi
882 ],
883 [
884 #753
885 with_liboping="yes"
886 ])
888 if test "x$with_liboping" = "xyes"
889 then
890 save_LDFLAGS="$LDFLAGS"
891 save_CPPFLAGS="$CPPFLAGS"
892 LDFLAGS="$liboping_LDFLAGS"
893 CPPFLAGS="$liboping_CPPFLAGS"
894 AC_CHECK_LIB(oping, ping_construct,
895 [
896 with_liboping="yes"
897 with_own_liboping="no"
898 ],
899 [
900 with_liboping="yes"
901 with_own_liboping="yes"
902 LDFLAGS="$save_LDFLAGS"
903 CPPFLAGS="$save_CPPFLAGS"
904 ])
905 fi
906 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
907 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
908 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
909 then
910 with_liboping="yes (shipped version)"
911 fi
913 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
914 [
915 if test "x$withval" != "xno" && test "x$withval" != "xyes"
916 then
917 LDFLAGS="$LDFLAGS -L$withval/lib"
918 CPPFLAGS="$CPPFLAGS -I$withval/include"
919 with_libpcap="yes"
920 fi
921 ],
922 [
923 with_libpcap="yes"
924 ])
925 if test "x$with_libpcap" = "xyes"
926 then
927 AC_CHECK_LIB(pcap, pcap_open_live,
928 [
929 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
930 ], [with_libpcap="no (libpcap not found)"])
931 fi
932 if test "x$with_libpcap" = "xyes"
933 then
934 AC_CHECK_HEADERS(pcap.h,
935 [
936 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
937 ], [with_libpcap="no (pcap.h not found)"])
938 fi
939 if test "x$with_libpcap" = "xyes"
940 then
941 collect_libpcap=1
942 else
943 collect_libpcap=0
944 fi
945 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
946 [Wether or not to use the pcap library])
947 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
949 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
950 [
951 if test "x$withval" != "xno" && test "x$withval" != "xyes"
952 then
953 LDFLAGS="$LDFLAGS -L$withval/lib"
954 CPPFLAGS="$CPPFLAGS -I$withval/include"
955 with_libiptc="yes"
956 fi
957 ],
958 [
959 if test "x$ac_system" = "xLinux"
960 then
961 with_libiptc="yes"
962 else
963 with_libiptc="no (Linux only)"
964 fi
965 ])
966 if test "x$with_libiptc" = "xyes"
967 then
968 AC_CHECK_LIB(iptc, iptc_init,
969 [
970 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
971 ], [with_libiptc="no (libiptc not found)"])
972 fi
973 if test "x$with_libiptc" = "xyes"
974 then
975 AC_CHECK_HEADERS(libiptc/libiptc.h,
976 [
977 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
978 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
979 fi
980 if test "x$with_libiptc" = "xyes"
981 then
982 collect_libiptc=1
983 else
984 collect_libiptc=0
985 fi
986 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
988 # Define `step' and `hearbeat' values..
989 declare -i collectd_step=10
990 declare -i collectd_heartbeat=25
991 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
992 [
993 if test "x$withval" != "xno" -a "x$withval" != "xyes"
994 then
995 declare -i tmp_collectd_step="$withval"
996 if test $tmp_collectd_step -gt 0
997 then
998 collectd_step=$tmp_collectd_step
999 let "collectd_heartbeat=$collectd_step*2"
1000 fi
1001 fi
1002 ], [])
1003 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
1004 [
1005 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1006 then
1007 declare -i tmp_collectd_heartbeat="$withval"
1008 if test $tmp_collectd_heartbeat -gt 0
1009 then
1010 collectd_heartbeat=$tmp_collectd_heartbeat
1011 fi
1012 fi
1013 ], [])
1015 if test $collectd_step -ne 10
1016 then
1017 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
1018 fi
1019 if test $collectd_heartbeat -ne 25
1020 then
1021 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
1022 fi
1024 # Check for enabled/disabled features
1025 #
1027 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1028 # ------------------------------------------------------------
1029 dnl
1030 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1031 dnl
1032 AC_DEFUN(
1033 [AC_COLLECTD],
1034 [
1035 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1036 m4_if(
1037 [$2],
1038 [enable],
1039 [dnl
1040 m4_define([EnDis],[disabled])dnl
1041 m4_define([YesNo],[no])dnl
1042 ],dnl
1043 [m4_if(
1044 [$2],
1045 [disable],
1046 [dnl
1047 m4_define([EnDis],[enabled])dnl
1048 m4_define([YesNo],[yes])dnl
1049 ],
1050 [dnl
1051 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1052 ]dnl
1053 )]dnl
1054 )dnl
1055 m4_if([$3], [feature], [],
1056 [m4_if(
1057 [$3], [module], [],
1058 [dnl
1059 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1060 ]dnl
1061 )]dnl
1062 )dnl
1063 AC_ARG_ENABLE(
1064 [$1],
1065 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1066 [],
1067 enable_$1='[YesNo]'dnl
1068 )# AC_ARG_ENABLE
1069 if test "x$enable_$1" = "xno"
1070 then
1071 collectd_$1=0
1072 else
1073 if test "x$enable_$1" = "xyes"
1074 then
1075 collectd_$1=1
1076 else
1077 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1078 collectd_$1=1
1079 enable_$1='yes'
1080 fi
1081 fi
1082 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1083 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1084 ]dnl
1085 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1087 m4_divert_once([HELP_ENABLE], [
1088 collectd features:])
1089 AC_COLLECTD([debug], [enable], [feature], [debugging])
1090 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1091 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1093 m4_divert_once([HELP_ENABLE], [
1094 collectd modules:])
1095 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1096 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1097 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1098 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1099 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1100 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1101 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1102 AC_COLLECTD([df], [disable], [module], [df statistics])
1103 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1104 AC_COLLECTD([email], [disable], [module], [email statistics])
1105 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
1106 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1107 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1108 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1109 AC_COLLECTD([load], [disable], [module], [system load statistics])
1110 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1111 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1112 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1113 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1114 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1115 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1116 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1117 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1118 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1119 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1120 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1121 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1122 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
1123 AC_COLLECTD([users], [disable], [module], [user count statistics])
1124 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1125 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1127 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
1129 cat <<EOF;
1131 Configuration:
1132 Libraries:
1133 libcurl . . . . . . $with_libcurl
1134 libiokit . . . . . $with_libiokit
1135 liboping . . . . . $with_liboping
1136 librrd . . . . . . $with_rrdtool
1137 lm_sensors . . . . $with_lm_sensors
1138 libstatgrab . . . . $with_libstatgrab
1139 libkstat . . . . . $with_kstat
1140 libmysql . . . . . $with_libmysql
1141 libpcap . . . . . . $with_libpcap
1142 libiptc . . . . . . $with_libiptc
1143 libpthread . . . . $with_libpthread
1145 Features:
1146 debug . . . . . . . $enable_debug
1147 daemon mode . . . . $enable_daemon
1148 step . . . . . . . $collectd_step seconds
1149 heartbeat . . . . . $collectd_heartbeat seconds
1151 Modules:
1152 apache . . . . . . $enable_apache
1153 apcups . . . . . . $enable_apcups
1154 apple_sensors . . . $enable_apple_sensors
1155 battery . . . . . . $enable_battery
1156 cpu . . . . . . . . $enable_cpu
1157 cpufreq . . . . . . $enable_cpufreq
1158 df . . . . . . . . $enable_df
1159 disk . . . . . . . $enable_disk
1160 dns . . . . . . . . $enable_dns
1161 email . . . . . . . $enable_email
1162 hddtemp . . . . . . $enable_hddtemp
1163 irq . . . . . . . . $enable_irq
1164 iptables . . . . . $enable_iptables
1165 load . . . . . . . $enable_load
1166 mbmon . . . . . . . $enable_mbmon
1167 memory . . . . . . $enable_memory
1168 multimeter . . . . $enable_multimeter
1169 mysql . . . . . . . $enable_mysql
1170 nfs . . . . . . . . $enable_nfs
1171 ntpd . . . . . . . $enable_ntpd
1172 ping . . . . . . . $enable_ping
1173 processes . . . . . $enable_processes
1174 sensors . . . . . . $enable_sensors
1175 serial . . . . . . $enable_serial
1176 swap . . . . . . . $enable_swap
1177 tape . . . . . . . $enable_tape
1178 traffic . . . . . . $enable_traffic
1179 users . . . . . . . $enable_users
1180 vserver . . . . . . $enable_vserver
1181 wireless . . . . . $enable_wireless
1183 EOF