1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.10.3)
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 src/libconfig)
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 ])
153 # For cpu modules
154 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
155 AC_CHECK_HEADERS(mach/mach_init.h)
156 AC_CHECK_HEADERS(mach/host_priv.h)
157 AC_CHECK_HEADERS(mach/mach_error.h)
158 AC_CHECK_HEADERS(mach/mach_host.h)
159 AC_CHECK_HEADERS(mach/mach_port.h)
160 AC_CHECK_HEADERS(mach/mach_types.h)
161 AC_CHECK_HEADERS(mach/message.h)
162 AC_CHECK_HEADERS(mach/processor_set.h)
163 AC_CHECK_HEADERS(mach/processor.h)
164 AC_CHECK_HEADERS(mach/processor_info.h)
165 AC_CHECK_HEADERS(mach/task.h)
166 AC_CHECK_HEADERS(mach/thread_act.h)
167 AC_CHECK_HEADERS(mach/vm_region.h)
168 AC_CHECK_HEADERS(mach/vm_map.h)
169 AC_CHECK_HEADERS(mach/vm_prot.h)
170 AC_CHECK_HEADERS(mach/vm_statistics.h)
171 AC_CHECK_HEADERS(mach/kern_return.h)
173 # For hddtemp module
174 AC_CHECK_HEADERS(linux/major.h)
176 # For the apple_sensors module
177 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
178 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
179 AC_CHECK_HEADERS(IOKit/IOTypes.h)
181 # For the battery plugin
182 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
183 [
184 #if HAVE_IOKIT_IOKITLIB_H
185 # include <IOKit/IOKitLib.h>
186 #endif
187 #if HAVE_IOKIT_IOTYPES_H
188 # include <IOKit/IOTypes.h>
189 #endif
190 ])
191 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
193 # For the `disk' plugin
194 AC_CHECK_HEADERS(IOKit/IOBSD.h)
195 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
197 # For load module
198 AC_CHECK_HEADERS(sys/loadavg.h)
200 # For the processes plugin
201 AC_CHECK_HEADERS(linux/config.h)
203 # For the swap module
204 AC_CHECK_HEADERS(sys/swap.h)
206 # For users module
207 AC_CHECK_HEADERS(utmp.h)
208 AC_CHECK_HEADERS(utmpx.h)
210 # For traffic plugin
211 AC_CHECK_HEADERS(ifaddrs.h)
212 AC_CHECK_HEADERS(net/if.h, [], [],
213 [
214 #if HAVE_SYS_TYPES_H
215 # include <sys/types.h>
216 #endif
217 #if HAVE_SYS_SOCKET_H
218 # include <sys/socket.h>
219 #endif
220 ])
221 AC_CHECK_HEADERS(linux/if.h, [], [],
222 [
223 #if HAVE_SYS_TYPES_H
224 # include <sys/types.h>
225 #endif
226 #if HAVE_SYS_SOCKET_H
227 # include <sys/socket.h>
228 #endif
229 ])
230 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
231 [
232 #if HAVE_SYS_TYPES_H
233 # include <sys/types.h>
234 #endif
235 #if HAVE_SYS_SOCKET_H
236 # include <sys/socket.h>
237 #endif
238 #if HAVE_LINUX_IF_H
239 # include <linux/if.h>
240 #endif
241 ])
243 # For apache plugin
244 AC_CHECK_HEADERS(curl/curl.h)
246 # For quota module
247 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
248 AC_CHECK_HEADERS(ctype.h)
249 AC_CHECK_HEADERS(limits.h)
250 AC_CHECK_HEADERS(sys/quota.h)
251 AC_CHECK_HEADERS(xfs/xqm.h)
253 # For mount interface
254 AC_CHECK_HEADERS(fs_info.h)
255 AC_CHECK_HEADERS(fshelp.h)
256 AC_CHECK_HEADERS(paths.h)
257 AC_CHECK_HEADERS(mntent.h)
258 AC_CHECK_HEADERS(mnttab.h)
259 AC_CHECK_HEADERS(sys/fstyp.h)
260 AC_CHECK_HEADERS(sys/fs_types.h)
261 AC_CHECK_HEADERS(sys/mntent.h)
262 AC_CHECK_HEADERS(sys/mnttab.h)
263 AC_CHECK_HEADERS(sys/mount.h)
264 AC_CHECK_HEADERS(sys/statfs.h)
265 AC_CHECK_HEADERS(sys/statvfs.h)
266 AC_CHECK_HEADERS(sys/vfs.h)
267 AC_CHECK_HEADERS(sys/vfstab.h)
269 # For the swap plugin, FreeBSD
270 AC_CHECK_HEADERS(kvm.h)
272 # For the email plugin
273 AC_CHECK_HEADERS(linux/un.h, [], [],
274 [
275 #if HAVE_SYS_SOCKET_H
276 # include <sys/socket.h>
277 #endif
278 ])
279 AC_CHECK_HEADERS(sys/un.h)
280 AC_CHECK_HEADERS(grp.h)
282 # For debugging interface (variable number of arguments)
283 AC_CHECK_HEADERS(stdarg.h)
285 dnl Checking for libraries
286 AC_CHECK_LIB(m, ext)
288 #
289 # Checks for typedefs, structures, and compiler characteristics.
290 #
291 AC_C_CONST
292 AC_TYPE_PID_T
293 AC_TYPE_SIZE_T
294 AC_TYPE_UID_T
295 AC_HEADER_TIME
297 #
298 # Checks for library functions.
299 #
300 AC_PROG_GCC_TRADITIONAL
301 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
302 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
303 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
304 AC_CHECK_FUNCS(strncasecmp strcasecmp)
305 AC_CHECK_FUNCS(openlog syslog closelog)
307 socket_needs_socket="no"
308 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
309 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
311 nanosleep_needs_rt="no"
312 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
313 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
315 # For cpu module
316 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
318 # For df module
319 AC_CHECK_FUNCS(statfs statvfs)
321 # For load module
322 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
324 # For the `processes' plugin
325 AC_CHECK_FUNCS(thread_info)
327 # For users module
328 AC_CHECK_FUNCS(getutent getutxent)
330 # For quota module
331 AC_CHECK_FUNCS(quotactl)
332 AC_CHECK_FUNCS(getgrgid getpwuid)
334 # For traffic module
335 AC_CHECK_FUNCS(getifaddrs)
337 # For mount interface
338 #AC_CHECK_FUNCS(getfsent getvfsent)
340 have_getfsstat="no"
341 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
342 have_getvfsstat="no"
343 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
344 have_listmntent="no"
345 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
347 have_getmntent="no"
348 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
349 if test "x$have_getmntent" = "xno"; then
350 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
351 fi
352 if test "x$have_getmntent" = "xno"; then
353 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
354 fi
355 if test "x$have_getmntent" = "xno"; then
356 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
357 fi
359 if test "x$have_getmntent" = "xc"; then
360 AC_CACHE_CHECK([whether getmntent takes one argument],
361 [have_one_getmntent],
362 AC_COMPILE_IFELSE(
363 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
364 #include <mntent.h>
365 #include "$srcdir/src/utils_mount.h"]],
366 [[
367 FILE *fh;
368 struct mntent *me;
369 fh = setmntent ("/etc/mtab", "r");
370 me = getmntent (fh);
371 ]]
372 ),
373 [have_one_getmntent="yes"],
374 [have_one_getmntent="no"]
375 )
376 )
377 AC_CACHE_CHECK([whether getmntent takes two arguments],
378 [have_two_getmntent],
379 AC_COMPILE_IFELSE(
380 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
381 #include <sys/mnttab.h>
382 #include "$srcdir/src/utils_mount.h"]],
383 [[
384 FILE *fh;
385 struct mnttab mt;
386 int status;
387 fh = fopen ("/etc/mnttab", "r");
388 status = getmntent (fh, &mt);
389 ]]
390 ),
391 [have_two_getmntent="yes"],
392 [have_two_getmntent="no"]
393 )
394 )
395 fi
397 # Check for different versions of `getmntent' here..
399 if test "x$have_getmntent" = "xc"; then
400 if test "x$have_one_getmntent" = "xyes"; then
401 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
402 [Define if the function getmntent exists and takes one argument.])
403 fi
404 if test "x$have_two_getmntent" = "xyes"; then
405 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
406 [Define if the function getmntent exists and takes two arguments.])
407 fi
408 fi
409 if test "x$have_getmntent" = "xsun"; then
410 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
411 [Define if the function getmntent exists. It's the version from libsun.])
412 fi
413 if test "x$have_getmntent" = "xseq"; then
414 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
415 [Define if the function getmntent exists. It's the version from libseq.])
416 fi
417 if test "x$have_getmntent" = "xgen"; then
418 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
419 [Define if the function getmntent exists. It's the version from libgen.])
420 fi
422 # Check for structures
423 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
424 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
425 [],
426 [
427 #include <sys/types.h>
428 #include <sys/socket.h>
429 #include <net/if.h>
430 ])
431 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
432 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
433 [],
434 [
435 #include <sys/types.h>
436 #include <sys/socket.h>
437 #include <linux/if.h>
438 #include <linux/netdevice.h>
439 ])
441 AC_MSG_CHECKING([for kernel type ($host_os)])
442 case $host_os in
443 *linux*)
444 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
445 ac_system="Linux"
446 ;;
447 *solaris*)
448 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
449 ac_system="Solaris"
450 ;;
451 *)
452 ac_system="unknown"
453 esac
454 AC_MSG_RESULT([$ac_system])
456 with_libresolv="yes"
457 AC_CHECK_LIB(resolv, res_search,
458 [
459 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
460 ],
461 [with_libresolv="no"])
462 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
465 m4_divert_once([HELP_WITH], [
466 collectd additional packages:])
468 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
469 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
470 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
471 then
472 LDFLAGS="$LDFLAGS -L$withval/lib"
473 CPPFLAGS="$CPPFLAGS -I$withval/include"
474 with_rrdtool="yes"
475 fi
476 ], [with_rrdtool="yes"])
477 if test "x$with_rrdtool" = "xyes"
478 then
479 AC_CHECK_LIB(rrd, rrd_update,
480 [
481 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
482 ],
483 [with_rrdtool="no (librrd not found)"], [-lm])
484 fi
485 if test "x$with_rrdtool" = "xyes"
486 then
487 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
488 fi
489 if test "x$with_rrdtool" = "xyes"
490 then
491 collect_rrdtool=1
492 else
493 collect_rrdtool=0
494 fi
495 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
496 [Wether or not to use rrdtool library])
497 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
499 #AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
500 #[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
501 # then
502 # LDFLAGS="$LDFLAGS -L$withval/lib"
503 # CPPFLAGS="$CPPFLAGS -I$withval/include"
504 # with_pth="yes"
505 # fi
506 #], [with_pth="no"])
507 #if test "x$with_pth" = "xyes"
508 #then
509 # AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
510 #fi
511 #if test "x$with_pth" = "xyes"
512 #then
513 # AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
514 #fi
515 #if test "x$with_pth" = "xyes"
516 #then
517 # collect_pth=1
518 #else
519 # collect_pth=0
520 #fi
521 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
522 # [Wether or not to use pth (portable threads) library])
523 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
525 if test "$ac_system" = "Solaris"
526 then
527 with_kstat="yes"
528 with_devinfo="yes"
529 else
530 with_kstat="no (Solaris only)"
531 with_devinfo="no (Solaris only)"
532 fi
534 if test "x$with_kstat" = "xyes"
535 then
536 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
537 fi
538 if test "x$with_kstat" = "xyes"
539 then
540 AC_CHECK_LIB(devinfo, di_init,, [with_devinfo="no (not found)"])
541 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
542 fi
543 if test "x$with_kstat" = "xyes"
544 then
545 collect_kstat=1
546 else
547 collect_kstat=0
548 fi
549 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
550 [Wether or not to use kstat library (Solaris)])
551 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
552 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
554 ### BEGIN of check for libcurl ###
555 with_curl_config="curl-config"
556 with_curl_prefix=0
557 with_curl_libs=""
558 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
559 [
560 if test "x$withval" != "xno" -a "x$withval" != "xyes"
561 then
562 if test -x "$withval/bin/curl-config"
563 then
564 with_curl_config="$withval/bin/curl-config"
565 with_curl_prefix=1
566 fi
567 fi
568 if test "x$withval" = "xno"
569 then
570 with_libcurl="no"
571 else
572 with_libcurl="yes"
573 fi
574 ],
575 [
576 with_libcurl="yes"
577 ])
578 if test "x$with_libcurl" = "xyes"
579 then
580 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
581 curl_config_status=$?
583 if test $curl_config_status -ne 0
584 then
585 with_libcurl="no"
586 else
587 AC_CHECK_LIB(curl, curl_easy_init,
588 [
589 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
590 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
591 ],
592 [
593 with_libcurl="no"
594 ],
595 [$with_curl_libs])
596 fi
597 fi
598 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
599 then
600 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
601 curl_config_status=$?
603 if test $curl_config_status -ne 0
604 then
605 with_libcurl="no"
606 else
607 if test -d "$with_curl_prefix/include"
608 then
609 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
610 fi
611 fi
612 fi
614 with_libcurl_numeric=0
615 if test "x$with_libcurl" = "xyes"
616 then
617 with_libcurl_numeric=1
618 fi
619 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
620 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
621 ### END of check for libcurl ###
623 with_libiokit="no"
624 collectd_libiokit=0
625 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
626 [
627 with_libiokit="yes"
628 collectd_libiokit=1
629 ],
630 [
631 with_libiokit="no"
632 collectd_libiokit=0
633 ])
634 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
635 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
637 with_libstatgrab="yes"
638 with_libdevstat="no"
639 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
640 [
641 if test "x$withval" != "xno" -a "x$withval" != "xyes"
642 then
643 LDFLAGS="$LDFLAGS -L$withval/lib"
644 CPPFLAGS="$CPPFLAGS -I$withval/include"
645 with_libstatgrab="yes"
646 fi
647 ],
648 [
649 if test "x$ac_system" == "xunknown"
650 then
651 with_libstatgrab="yes"
652 else
653 with_libstatgrab="no"
654 fi
655 ])
656 if test "x$with_libstatgrab" = "xyes"
657 then
658 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
659 fi
660 if test "x$with_libstatgrab" = "xyes"
661 then
662 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
663 fi
664 if test "x$with_libstatgrab" = "xyes"
665 then
666 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
667 fi
668 if test "x$with_libstatgrab" = "xyes"
669 then
670 collect_libstatgrab=1
671 else
672 collect_libstatgrab=0
673 fi
674 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
675 [Wether or not to use statgrab library])
676 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
677 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
679 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
680 if test "x$with_libkvm" = "xyes"
681 then
682 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
683 fi
684 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
686 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
687 [
688 if test "x$withval" != "xno" && test "x$withval" != "xyes"
689 then
690 LDFLAGS="$LDFLAGS -L$withval/lib"
691 CPPFLAGS="$CPPFLAGS -I$withval/include"
692 with_lm_sensors="yes"
693 fi
694 ],
695 [
696 if test "x$ac_system" = "xLinux"
697 then
698 with_lm_sensors="yes"
699 else
700 with_lm_sensors="no"
701 fi
702 ])
703 if test "x$with_lm_sensors" = "xyes"
704 then
705 AC_CHECK_LIB(sensors, sensors_init,
706 [
707 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
708 ],
709 [with_lm_sensors="no (libsensors not found)"])
710 fi
711 if test "x$with_lm_sensors" = "xyes"
712 then
713 AC_CHECK_HEADERS(sensors/sensors.h,
714 [
715 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
716 ],
717 [with_lm_sensors="no (sensors/sensors.h not found)"])
718 fi
719 if test "x$with_lm_sensors" = "xyes"
720 then
721 collect_lm_sensors=1
722 else
723 collect_lm_sensors=0
724 fi
725 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
726 [Wether or not to use sensors library])
727 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
729 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
730 [
731 if test "x$withval" != "xno" && test "x$withval" != "xyes"
732 then
733 LDFLAGS="$LDFLAGS -L$withval/lib"
734 CPPFLAGS="$CPPFLAGS -I$withval/include"
735 with_libmysql="yes"
736 fi
737 ],
738 [
739 with_libmysql="yes"
740 ])
741 if test "x$with_libmysql" = "xyes"
742 then
743 AC_CHECK_LIB(mysqlclient, mysql_init,
744 [
745 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
746 ], [with_libmysql="no (libmysql not found)"])
747 fi
748 if test "x$with_libmysql" = "xyes"
749 then
750 AC_CHECK_HEADERS(mysql/mysql.h,
751 [
752 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
753 ], [with_libmysql="no (mysql/mysql.h not found)"])
754 fi
755 if test "x$with_libmysql" = "xyes"
756 then
757 collect_libmysql=1
758 else
759 collect_libmysql=0
760 fi
761 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
762 [Wether or not to use mysql library])
763 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
765 #with_liboping="yes"
766 with_own_liboping="no"
767 liboping_LDFLAGS="$LDFLAGS"
768 liboping_CPPFLAGS="$CPPFLAGS"
769 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
770 [
771 if test "x$withval" != "xno" && test "x$withval" != "xyes"
772 then
773 if test -d "$withval/lib"
774 then
775 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
776 fi
777 if test -d "$withval/include"
778 then
779 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
780 fi
781 fi
782 if test "x$withval" = "xno"
783 then
784 with_liboping="no"
785 with_own_liboping="no"
786 fi
787 ],
788 [
789 #753
790 with_liboping="yes"
791 ])
793 if test "x$with_liboping" = "xyes"
794 then
795 save_LDFLAGS="$LDFLAGS"
796 save_CPPFLAGS="$CPPFLAGS"
797 LDFLAGS="$liboping_LDFLAGS"
798 CPPFLAGS="$liboping_CPPFLAGS"
799 AC_CHECK_LIB(oping, ping_construct,
800 [
801 with_liboping="yes"
802 with_own_liboping="no"
803 ],
804 [
805 with_liboping="yes"
806 with_own_liboping="yes"
807 LDFLAGS="$save_LDFLAGS"
808 CPPFLAGS="$save_CPPFLAGS"
809 ])
810 fi
811 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
812 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
813 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
814 then
815 with_liboping="yes (shipped version)"
816 fi
818 # Define `step' and `hearbeat' values..
819 declare -i collectd_step=10
820 declare -i collectd_heartbeat=25
821 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
822 [
823 if test "x$withval" != "xno" -a "x$withval" != "xyes"
824 then
825 declare -i tmp_collectd_step="$withval"
826 if test $tmp_collectd_step -gt 0
827 then
828 collectd_step=$tmp_collectd_step
829 let "collectd_heartbeat=$collectd_step*2"
830 fi
831 fi
832 ], [])
833 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
834 [
835 if test "x$withval" != "xno" -a "x$withval" != "xyes"
836 then
837 declare -i tmp_collectd_heartbeat="$withval"
838 if test $tmp_collectd_heartbeat -gt 0
839 then
840 collectd_heartbeat=$tmp_collectd_heartbeat
841 fi
842 fi
843 ], [])
845 if test $collectd_step -ne 10
846 then
847 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
848 fi
849 if test $collectd_heartbeat -ne 25
850 then
851 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
852 fi
854 dnl Check for regex
855 AC_ARG_WITH(regex, [AS_HELP_STRING([--with-regex], [Use POSIX regular expression in config.])],
856 [
857 if test "x$withval" != "xno" && test "x$withval" != "xyes"
858 then
859 with_regex="yes"
860 fi
861 ],
862 [
863 with_regex="no"
864 ])
865 if test "x$with_regex" = "xyes"
866 then
867 AC_CHECK_FUNCS([regcomp regexec],
868 [with_regfuncs="yes"],
869 [with_regfuncs="no (regcomp & regexec not found)"])
870 fi
871 if test "x$with_regex" = "xyes"
872 then
873 AC_CHECK_HEADERS(regex.h,
874 [with_regexh="yes"],
875 [with_regexh="no (regex.h not found)"])
876 fi
877 if test "x$with_regex" = "xyes" -a "x$with_regfuncs" = "xyes" -a "x$with_regexh" = "xyes"
878 then
879 collect_regex=1
880 else
881 collect_regex=0
882 fi
883 AC_DEFINE_UNQUOTED(COLLECT_REGEX, [$collect_regex],
884 [Wether or not to use regular expressions])
885 AM_CONDITIONAL(BUILD_WITH_REGEX, test "x$with_regex" = "xyes")
887 # Check for enabled/disabled features
888 #
890 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
891 # ------------------------------------------------------------
892 dnl
893 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
894 dnl
895 AC_DEFUN(
896 [AC_COLLECTD],
897 [
898 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
899 m4_if(
900 [$2],
901 [enable],
902 [dnl
903 m4_define([EnDis],[disabled])dnl
904 m4_define([YesNo],[no])dnl
905 ],dnl
906 [m4_if(
907 [$2],
908 [disable],
909 [dnl
910 m4_define([EnDis],[enabled])dnl
911 m4_define([YesNo],[yes])dnl
912 ],
913 [dnl
914 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
915 ]dnl
916 )]dnl
917 )dnl
918 m4_if([$3], [feature], [],
919 [m4_if(
920 [$3], [module], [],
921 [dnl
922 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
923 ]dnl
924 )]dnl
925 )dnl
926 AC_ARG_ENABLE(
927 [$1],
928 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
929 [],
930 enable_$1='[YesNo]'dnl
931 )# AC_ARG_ENABLE
932 if test "x$enable_$1" = "xno"
933 then
934 collectd_$1=0
935 else
936 if test "x$enable_$1" = "xyes"
937 then
938 collectd_$1=1
939 else
940 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
941 collectd_$1=1
942 enable_$1='yes'
943 fi
944 fi
945 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
946 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
947 ]dnl
948 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
950 m4_divert_once([HELP_ENABLE], [
951 collectd features:])
952 AC_COLLECTD([debug], [enable], [feature], [debugging])
953 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
954 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
956 m4_divert_once([HELP_ENABLE], [
957 collectd modules:])
958 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
959 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
960 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
961 AC_COLLECTD([battery], [disable], [module], [battery statistics])
962 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
963 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
964 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
965 AC_COLLECTD([df], [disable], [module], [df statistics])
966 AC_COLLECTD([email], [disable], [module], [email statistics])
967 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
968 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
969 AC_COLLECTD([load], [disable], [module], [system load statistics])
970 AC_COLLECTD([memory], [disable], [module], [memory statistics])
971 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
972 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
973 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
974 AC_COLLECTD([ntpd], [disable], [module], [nfs statistics])
975 AC_COLLECTD([ping], [disable], [module], [ping statistics])
976 AC_COLLECTD([processes], [disable], [module], [processes statistics])
977 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
978 AC_COLLECTD([serial], [disable], [module], [serial statistics])
979 AC_COLLECTD([swap], [disable], [module], [swap statistics])
980 AC_COLLECTD([tape], [disable], [module], [tape statistics])
981 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
982 AC_COLLECTD([users], [disable], [module], [user count statistics])
983 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
984 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
986 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
988 cat <<EOF;
990 Configuration:
991 Libraries:
992 libcurl . . . . . . $with_libcurl
993 libiokit . . . . . $with_libiokit
994 liboping . . . . . $with_liboping
995 librrd . . . . . . $with_rrdtool
996 lm_sensors . . . . $with_lm_sensors
997 libstatgrab . . . . $with_libstatgrab
998 libkstat . . . . . $with_kstat
999 libmysql . . . . . $with_libmysql
1000 regex . . . . . . . $with_regex
1002 Features:
1003 debug . . . . . . . $enable_debug
1004 daemon mode . . . . $enable_daemon
1005 step . . . . . . . $collectd_step seconds
1006 heartbeat . . . . . $collectd_heartbeat seconds
1008 Modules:
1009 apache . . . . . . $enable_apache
1010 apcups . . . . . . $enable_apcups
1011 apple_sensors . . . $enable_apple_sensors
1012 battery . . . . . . $enable_battery
1013 cpu . . . . . . . . $enable_cpu
1014 cpufreq . . . . . . $enable_cpufreq
1015 df . . . . . . . . $enable_df
1016 disk . . . . . . . $enable_disk
1017 email . . . . . . . $enable_email
1018 hddtemp . . . . . . $enable_hddtemp
1019 load . . . . . . . $enable_load
1020 memory . . . . . . $enable_memory
1021 multimeter . . . . $enable_multimeter
1022 mysql . . . . . . . $enable_mysql
1023 nfs . . . . . . . . $enable_nfs
1024 ntpd . . . . . . . $enable_ntpd
1025 ping . . . . . . . $enable_ping
1026 processes . . . . . $enable_processes
1027 sensors . . . . . . $enable_sensors
1028 serial . . . . . . $enable_serial
1029 swap . . . . . . . $enable_swap
1030 tape . . . . . . . $enable_tape
1031 traffic . . . . . . $enable_traffic
1032 users . . . . . . . $enable_users
1033 vserver . . . . . . $enable_vserver
1034 wireless . . . . . $enable_wireless
1036 EOF